<div class="actions">
  @if (!config.actions) {
    <div class="flex items-start mt-5 md:ml-5 pl-3">
      @if (isMy()) {
        <button mat-button color="primary" (click)="onUpdate()">
          <mat-icon inline="true">editor</mat-icon> 修改
        </button>
      }
      @if (!item.child) {
        <button mat-button color="primary" (click)="onReply()">
          <mat-icon inline="true">reply</mat-icon> 回复
        </button>
      }
      @if (!item.child) {
        <button mat-button color="primary" (click)="onQuote()">
          <mat-icon inline="true">repeat</mat-icon> 引用
        </button>
      }
      @if (isMy()) {
        <button mat-button color="primary" (click)="onDelete(item.id)">
          <div class="flex justify-center items-center">
            @if (loading) {
              <app-loading />
            }
            @if (!loading) {
              <mat-icon inline="true">delete</mat-icon>
            }
            删除
          </div>
        </button>
      }
    </div>
  } @else {
    <div class="mt-5 flex items-start md:ml-5 pl-3">
      @for (action of config.actions; track action) {
        @switch (action) {
          @case ('update') {
            @if (isMy()) {
              <button mat-button color="primary" (click)="onUpdate()">
                <mat-icon inline="true">editor</mat-icon> 修改
              </button>
            }
          }
          @case ('reply') {
            @if (item.level === 1) {
              <button mat-button color="primary" (click)="onReply()">
                <mat-icon inline="true">reply</mat-icon> 回复
              </button>
            }
          }
          @case ('quote') {
            @if (item.level === 1) {
              <button mat-button color="primary" (click)="onQuote()">
                <mat-icon inline="true">repeat</mat-icon> 引用
              </button>
            }
          }
          @case ('delete') {
            @if (isMy()) {
              <button mat-button color="primary" (click)="onDelete(item.id)">
                <div class="flex justify-center items-center">
                  @if (loading) {
                    <app-loading />
                  }
                  @if (!loading) {
                    <mat-icon inline="true">delete</mat-icon>
                  }
                  删除
                </div>
              </button>
            }
          }
        }
      }
    </div>
  }
</div>
